/*
	Lock.h

	Contains headers for a fast mutual exclusion lock for multi-threading within the engine

	Author: Aidan Goddard 25/8/14
*/

#ifndef LOCK_H_INCLUDED
#define LOCK_H_INCLUDED

#include<cstdint>

#ifdef USE_BROKEN_BAKERY_LOCK
extern "C" void LockSetup(uint32_t thread_count, uint32_t *bk_struct);
extern "C" uint32_t LockEnter(uint32_t thread_id, uint32_t *bk_struct);
extern "C" void LockLeave(uint32_t thread_id, uint32_t *bk_struct);
#define LockReset(x) ((uint32_t*)x)[512]=0
#else
extern "C" void SpinEnter(uint32_t *lock);
extern "C" void SpinLeave(uint32_t *lock);
#endif



#endif